package SI::Insurance::StopReason;
use base 'MyDB::Object';

__PACKAGE__->meta->setup(
    table => 'StopInsurReason',
    columns =>
    [
        code => { type => 'varchar', length => 2, not_null => 1 },
        value => { type => 'varchar', length => 60, not_null => 1 },
    ],
    allow_inline_column_values => 1,
    primary_key_columns => [ 'code' ],

);


sub init_tab {
    my $self = shift;
    my $stmt = 'CREATE TABLE IF NOT EXISTS StopInsurReason (
        code VARCHAR(3) PRIMARY KEY NOT NULL,  -- 中断参保原因码
        value VARCHAR(60) NOT NULL             -- 中断参保原因值
    );';
    my $db = $self->init_db;
    my $dbh = $db->dbh or die $db->error;
    $db->do_transaction(
        sub {$dbh->do($stmt)}) or die $db->error;
    return 1;

}
